package com.pingan.pastry.common.persistent.entity;


import com.pingan.pastry.util.IdUtil;
import com.pingan.pastry.common.util.UserUtil;
import com.pingan.pastry.entity.User;

import java.util.Date;

public class DataEntity {
    /**
     * 32位的uuid
     */
    protected String id;
    protected String createBy;
    protected Date createTime;
    protected String updateBy;
    protected Date updateTime;

    protected void preInsert() {
        User user = UserUtil.getCurrentUser();
        this.id = IdUtil.uuId();
        this.createBy = user.getPhoneNumber();
        this.createTime = new Date();
    }

    protected void preUpdate() {
        User user = UserUtil.getCurrentUser();
        this.updateBy = user.getPhoneNumber();
        this.updateTime = new Date();
    }


    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
